qui(
    function (require, exports, module) {
        Program.Dao = $.extend({}, EpgWeb.Dao, {
            //获取 oa 工单数据
            readOaStatus:function(data, callback){
                var oa_test_url = "http://oa-trunktest.qiyi.domain/api/live/getLiveDetailsForEpg";
                var oa_online_url = "http://home.qiyi.domain/api/live/getLiveDetailsForEpg";
                var options = {
                    "url": auth.dev() ? oa_test_url : oa_online_url,
                    "type": "post-raw",
                    "data": data,
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, null);
                    }
                }
                EpgWeb.Dao.sendProxy(options)
            },
            //更新 epg 关联 oa info数据
            updateOaInfo:function( data,  handler){
                var options = {
                    url: "/api/program/oainfo",
                    dataType: 'json',
                    data: {data:JSON.stringify(data)},
                    method: 'post',
                    success: function (data) {
                        handler.call(this, data);
                    },
                    error: function (data) {
                        handler.call(this, data);
                    }
                };
                Ancestor.Dao.ajax(options, '/program/oainfo');
            },

            // 节目添加
            setProgramAddData: function (data, callback) {
                var options = {
                    url: EpgWeb.urlConfig.programAdd,
                    dataType: 'json',
                    data: data,
                    method: 'post',
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                };
                Ancestor.Dao.ajax(options, '/program/add');
            },
            // 节目修改
            setProgramModifyData: function (data, callback) {
                var options = {
                    url: EpgWeb.urlConfig.programEdit,
                    dataType: 'json',
                    data: data,
                    method: 'post',
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                };

                Ancestor.Dao.ajax(options, '/program/edit');
            },
            // 节目删除
            deleteProgramData: function (data, callback) {
                var options = {
                    url: EpgWeb.urlConfig.programDel,
                    dataType: 'json',
                    data: data,
                    method: 'post',
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                };

                Ancestor.Dao.ajax(options, '/program/delete');
            },
            // 紧急检查
            forceCheckProgram: function (data, callback) {
                var options = {
                    url: EpgWeb.urlConfig.programForceCheck,
                    dataType: 'json',
                    data: data,
                    method: 'get',
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                };
                Ancestor.Dao.ajax(options, '/program/forceCheck');
            },
            // 获取节目数据列表
            getProgramListByDay: function (data, callback) {
                var options = {
                    url: EpgWeb.urlConfig.programList,
                    dataType: 'json',
                    data: data,
                    method: 'post',
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                };
                Ancestor.Dao.ajax(options, '/program/list');
            },

            //检查 导播台
            createDirector:function(data, callback){
                var options = {
                    url: "http://dbt.lego.iqiyi.com/api/director/create",
                    dataType: 'json',
                    data: data,
                    type: 'post',
                    timeout: 10000,
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                };
                var authBase = Ancestor.Util.getAuth("/director/create");
                var header = {
                    Sign: "#f93Uc31K24()_@",
                    Time: authBase.clientTime,
                    From: authBase.from,
                    UserName: (auth.baseInfo.authInfo == null) ? "" : escape(auth.baseInfo.authInfo.userName).toLocaleLowerCase().replace(/%u/gi, '\\u')

                };
                // EpgWeb.Dao.sendProxy(options, {Sign: "#f93Uc31K24()_@"});
                EpgWeb.Dao.sendProxy(options, header);
            },

            //同步tvmao 节目 start
            syncTVmaoPrograms: function (data, callback) {
                var options = {
                    url: EpgWeb.urlConfig.programSyncUrl,
                    dataType: 'json',
                    data: data,
                    method: 'post',
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                };
                Ancestor.Dao.ajax(options, "/program/syncTVMao");
            },
            //同步tvmao 节目 end

            liveChannelType: function () {
                return this.getDataByName(this.cfgName.liveChannelType)
            },

            liveProgramType: function () {
                return this.getDataByName(this.cfgName.liveProgramType);
            },

            liveType: function () {
                return this.getDataByName(this.cfgName.LiveType);
            },

            episodeGradeType: function () {
                return this.getDataByName(this.cfgName.episodeGradeType);
            },
            logType: function () {
                return this.getDataByName(this.cfgName.LogType);
            },
            recommendRateType:function(){
                return this.getDataByName(this.cfgName.recommendRateType);
            },
            getChannel: function () {
                return this.getDataByName(this.cfgName.getChannel).data;
            },
            targetName: function () {
                return  this.getDataByName(this.cfgName.targetName);
            },
            getProgram: function () {
                var responseData = this.targetName();
                if (responseData == null || responseData.data == null || responseData.data.totalCount == 0) {
                    return null;
                }
                return responseData.data.result[0];
            }
        })

        Program.Dao.cfgName = $.extend({}, EpgWeb.Dao.cfgName,{
            from: "library",
            targetName: "entity",
            puyuData: "puyuData",
            live_temp_other:"live_temp_other",
            category_use:"category_use",
            fatherId: 0,
            id: 0,
            editPic: true,
            categoryArr: null
        });
    }
);